<div class="layui-row layui-col-space15">
    <div class="layui-col-xs2">
        <label class="relative block">
            <span class="color-green font-w7">表单宽度</span>
            <input name="setting[width]" value='{$width|default="100"}' pattern="^\d+$" autocomplete="off" placeholder="请输入表单宽度" class="layui-input">
            <span class="color-desc">表单长度(单位百分比)</span>
        </label>
    </div>
    <div class="layui-col-xs2">
        <label class="relative block">
            <span class="color-green font-w7">表单样式</span>
            <input name="setting[css]" value='{$css|default="layui-input"}'  pattern="^[A-Za-z0-9_-]+$" placeholder="请输入表单样式名称" class="layui-input">
            <span class="color-desc">css样式的class名称</span>
        </label>
    </div>

    <div class="layui-col-xs2">
        <label class="relative block">
            <span class="color-green font-w7">是否开启最小/最大限定</span><br />
            {foreach :config('constant.YesOrNo') as $k=>$v}
            <!--{if (!isset($datetime_min_max_isopen) and $k eq '0') or (isset($datetime_min_max_isopen) and $datetime_min_max_isopen eq $k)}-->
            <input type="radio" name="setting[datetime_min_max_isopen]" lay-filter="datetime_filter"  checked value="{$k}" title="{$v}">
            <!--{else}-->
            <input type="radio" name="setting[datetime_min_max_isopen]" lay-filter="datetime_filter"  value="{$k}" title="{$v}">
            <!--{/if}-->
            {/foreach}
        </label>
    </div>
    <div class="datetime_min_max_options" {if (!isset($datetime_min_max_isopen) and $k eq '0') or (isset($datetime_min_max_isopen) and $datetime_min_max_isopen eq 0)} style="display: none" {/if}>
        <div class="layui-col-xs2">
            <label class="relative block">
                <span class="color-green font-w7">日期最小值</span>
                <input name="setting[datetime_min]" id="date_range_min"  value='{$datetime_min|default=""}'  placeholder="为空默认为当前系统日期" class="layui-input">
                <span class="color-desc">日期最小值，格式：yyyy-MM-dd</span>
            </label>
        </div>
        <div class="layui-col-xs2">
            <label class="relative block">
                <span class="color-green font-w7">日期最大值</span>
                <input name="setting[datetime_max]" id="date_range_max" value='{$datetime_max|default=""}' placeholder="请输入日期最大值" class="layui-input">
                <span class="color-desc">日期最大值，格式：yyyy-MM-dd</span>
            </label>
        </div>
    </div>
    <div class="layui-col-xs2">
        <label class="relative block">
            <span class="color-green font-w7">是否必选</span>
            <select name="setting[min]" lay-filter="colorselect_pattern">
                {foreach :config('constant.YesOrNo') as $key => $val}
                {eq name='key' value='$min|default="0"'}
                <option selected value='{$key}'>{$val}</option>
                {else}
                <option value='{$key}'>{$val}</option>
                {/eq}
                {/foreach}
            </select>
        </label>
    </div>
</div>
{if !$isupdate}
<div class="layui-row layui-col-space15">
    <div class="layui-col-xs3">
        <label class="relative block">
            <span class="color-green font-w7">字段类型</span><br />
            {php}$default = !isset($chartype)?'':$chartype;{/php}
            {$type|raw|htmlspecialchars_decode|rendFieldOptions=$default}
        </label>
    </div>
    <div class="layui-col-xs3">
        <label class="relative block">
            <span class="color-green font-w7">字段长度</span>
            <input type="text" name="setting[length]" value='{$length|default=""}'  autocomplete="off" required placeholder="请输入表单字段长度" class="layui-input">
            <span class="color-desc">字段长度</span>
        </label>
    </div>
    <div class="layui-col-xs3">
        <label class="relative block">
            <span class="color-green font-w7">默认值</span>
            <input type="text" name="setting[defaultvalue]" value='{$defaultvalue|default=""}' autocomplete="off" placeholder="为空则为默认系统时间" class="layui-input">
            <span class="color-desc">表单默认值</span>
        </label>
    </div>
</div>
{/if}
<script>
    layui.use(['layer', 'jquery'], function () {
        var layer = layui.layer,
            $ = layui.jquery;
        layui.form.render();

        laydate.render({
            elem: '#date_range_min'
        });
        laydate.render({
            elem: '#date_range_max'
        });
        form.on("radio(datetime_filter)", function (data) {
            if(parseInt(data.value)){
                $('.datetime_min_max_options').show();
            }else{
                $('.datetime_min_max_options').hide();
            }
        });
    });
</script>